using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableAuthRoles
	{
		public const string Table = "AuthRoles";
		public const string RoleID = "RoleID";
		public const string RoleName = "RoleName";
		public const string PermissionsIDList = "PermissionsIDList";
		public const string Description = "Description";
		public const string UerType = "UerType";
	}
	
	[Serializable]
	public class BaseAuthRoles
		: IDbSessionEntity, IJsonClass
	{
		int m_RoleID;
		/// <summary>
        /// 角色ID(主键)
        /// </summary>
        public int RoleID
        {
            get { return m_RoleID; }
            set { m_RoleID = value; }
        }
		
		string m_RoleName;
		/// <summary>
        /// 角色名称
        /// </summary>
        public string RoleName
        {
            get { return m_RoleName; }
            set { m_RoleName = value; }
        }
		
		string m_PermissionsIDList;
		/// <summary>
        /// 角色权限ID列表
        /// </summary>
        public string PermissionsIDList
        {
            get { return m_PermissionsIDList; }
            set { m_PermissionsIDList = value; }
        }
		
		string m_Description;
		/// <summary>
        /// 角色描述
        /// </summary>
        public string Description
        {
            get { return m_Description; }
            set { m_Description = value; }
        }
		
		int m_UerType;
		/// <summary>
        /// 用户权限类型
        /// </summary>
        public int UerType
        {
            get { return m_UerType; }
            set { m_UerType = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_RoleID = reader[TableAuthRoles.RoleID];
            m_RoleName = reader[TableAuthRoles.RoleName];
            m_PermissionsIDList = reader[TableAuthRoles.PermissionsIDList];
            m_Description = reader[TableAuthRoles.Description];
            m_UerType = reader[TableAuthRoles.UerType];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableAuthRoles.RoleID, PrimaryKeyType.Identity, RoleID);
			writer[TableAuthRoles.RoleName] = RoleName;
			writer[TableAuthRoles.PermissionsIDList] = PermissionsIDList;
			writer[TableAuthRoles.Description] = Description;
			writer[TableAuthRoles.UerType] = UerType;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_RoleID = idd;
        }
		
		public string TableName
        {
            get { return TableAuthRoles.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_RoleID = hashToRead["RoleID"];
			 
             m_RoleName = hashToRead["RoleName"];
			 
             m_PermissionsIDList = hashToRead["PermissionsIDList"];
			 
             m_Description = hashToRead["Description"];
			 
             m_UerType = hashToRead["UerType"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["RoleID"] = RoleID;
			 
            hashToFill["RoleName"] = RoleName;
			 
            hashToFill["PermissionsIDList"] = PermissionsIDList;
			 
            hashToFill["Description"] = Description;
			 
            hashToFill["UerType"] = UerType;
			 
        }

        #endregion
		
	}
}
